package top.tagao.m02_creationalPatterns.c_02_singleton;

/**
 * 饿汉式 同步代码块
 *
 * @author fu-xiao-liu
 * @Date 2022/6/22 23:35
 */
public class Singleton3 {

    private Singleton3() {
    }

    private static Singleton3 S3;


    public static Singleton3 getInstance() {
        if (S3 == null) {
            synchronized (Singleton3.class){
                if (S3 == null){
                    S3 = new Singleton3();
                }
            }
        }
        return S3;

    }
}
